package com.ykl.demo.model;

import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.SuperBuilder;

import java.text.DecimalFormat;
import java.text.SimpleDateFormat;

/**
 * .
 * <p></p>
 *
 * @author 王东石 2021/11/28 8:35.
 */
@Data
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
public class RoomImportResModel extends RoomExportCvsModel{
    /**
     * 数据错误原因.
     */
    private String reason;

    /**
     * 局站id.
     */
    private String stationId;


    public static RoomImportResModel ofReason(String reason){
        return RoomImportResModel.builder().reason(reason).build();
    }

    public String toLineNonReturnChar(DecimalFormat df, SimpleDateFormat sdf){
        //机房ID,机房名称,所属局站名称,机房地址,经度,纬度,机房等级,机房类型,投产时间
        //DecimalFormat df = new DecimalFormat("0.0#####");
        //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        return String.format("%s,%s,%s,%s,%s,%s,%s,%s,%s,%s",
                getRoomId(), getChinaName(), getStationName(), getAddress(), df.format(getX()), df.format(getY()),
                getClassId(), getTypeId(), sdf.format(getStartUseDate()), getReason());
    }

    public String toLineWithReturnChar(DecimalFormat df, SimpleDateFormat sdf, String returnChar){
        return toLineNonReturnChar(df, sdf)+returnChar;
    }

}
